package FingerGame;

public class Computer {
    private String model;           // 模式（难度）
    private int score;              // 得分
    private String skills;          // 技能
    private int currentFingerNo;    // 当前出拳

    public Computer(String model, int score) {
        this.model = model;
        this.score = score;
        if (model.equals("hard")){
            int select_flag = (int)(Math.random()*100)%3+1;
            switch (select_flag){
                case 1:
                    this.skills = "搅动潮汐之剑(胜利时获得双倍积分)";
                    break;
                case 2:
                    this.skills = "真银斩(平局时可视为胜利)";
                    break;
                case 3:
                    this.skills = "ALL之力(施展后有50％的概率交换双方出拳)";
            }
        } else {
            this.skills = "无";
        }

        this.showInfo();
    }

    public String getSkills() {
        return skills;
    }

    public void setSkills(String skills) {
        this.skills = skills;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }
    public int getScore() {
        return score;
    }
    public void setScore(int score) {
        this.score = score;
    }

    public int getCurrentFingerNo() {
        return currentFingerNo;
    }

    public void setCurrentFingerNo(int currentFingerNo) {
        this.currentFingerNo = currentFingerNo;
    }

    public void showInfo(){
        System.out.println("-----显示敌方角色信息-----\n" +
                "模式：" + model + "\n" +
                "初始积分：" + score + "\n" +
                "技能：" + skills);
    }

    public void win(){
        int gain = 1;
        if (skills.contains("胜利时获得双倍积分")){
            gain = 2;
            System.out.println(model + " 发动技能 搅动潮汐之剑，获得双倍积分！");
        }
        score += gain;
        System.out.println("本局" + model + "获胜，积分：" + score);
    }

    public void throwFinger(){
        int fingerNo = (int)(Math.random()*10)%3+1;

        switch (fingerNo) {
            case 1:
                System.out.println("电脑出拳：剪刀");
                break;
            case 2:
                System.out.println("电脑出拳：石头");
                break;
            case 3:
                System.out.println("电脑出拳：布");
                break;
        }

        this.setCurrentFingerNo(fingerNo);
    }
}
